package com.hitsf.controller;

import com.hitsf.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class RedisController {

    @Autowired
    RedisUtil redisUtil;

    //插入String
    @RequestMapping("/insertString")
    public boolean insertString(){
//      boolean b = redisUtil.set("name","Mark");
        boolean b = redisUtil.set("name","Mark",10);
        return b;
    }

    //递增
    @RequestMapping("/incr")
    public Object incr(){
        long l = redisUtil.incr("success",1);
        return redisUtil.get("success");
    }
}
